home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: getc()
- Date: 20 Apr 1996 18:09:55 -0700
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4lc1t3INNden@keats.ugrad.cs.ubc.ca>
- References: <Pine.LNX.3.91.960416043025.26839B-100000-100000-100000-100000-100000-100000-100000@larry.inf.net>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <Pine.LNX.3.91.960416043025.26839B-100000-100000-100000-100000-100000-100000-100000@larry.inf.net>,
- Lawrence O'Leary <larry@larry.inf.net> wrote:
- >
- >Is there a way to see if there is a character waiting before calling the
- >getc() function? I would need this to conform to the ANSI C standard of
- >course.
-
- No.
-
- The closest thing is to peek ahead using getc() and then if you decide you
- don't want the character, to put it back with ungetc(). (Only one character
- depth of ungetc() is guaranteed).
-
- To actually know whether the underlying device has input ready is beyond the
- scope of the C language and in the domain of system-specific techniques
- (asynchronous notification, non-blocking I/O, polling, reading hardware status
- registers, etc).
-